package com.imooc.service.model;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

public class GoodsModel implements Serializable {

  private Integer id;

  @NotBlank(message = "商品名称不能为空")
  private String title;

  @NotNull(message = "商品价格不能为空")
  @Min(value = 0, message = "商品价格必须大于0")
  private BigDecimal price;

  @NotNull(message = "库存不能不填")
  private Integer stock;

  @NotBlank(message = "商品描述信息不能为空")
  private String description;

  private Integer sales;

  @NotBlank(message = "商品图片不能为空")
  private String imgUrl;

  //使用聚合模型,如果promoModel不为空,表示其拥有还未结束的秒杀活动
  private PromoModel promoModel;

  public PromoModel getPromoModel() {
    return promoModel;
  }

  public void setPromoModel(PromoModel promoModel) {
    this.promoModel = promoModel;
  }

  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public String getTitle() {
    return title;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public BigDecimal getPrice() {
    return price;
  }

  public void setPrice(BigDecimal price) {
    this.price = price;
  }

  public Integer getStock() {
    return stock;
  }

  public void setStock(Integer stock) {
    this.stock = stock;
  }

  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public Integer getSales() {
    return sales;
  }

  public void setSales(Integer sales) {
    this.sales = sales;
  }

  public String getImgUrl() {
    return imgUrl;
  }

  public void setImgUrl(String imgUrl) {
    this.imgUrl = imgUrl;
  }
}
